﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QQuickItem>
#include "render/trianglewindow.h"

class MainWindow : public QQuickItem
{
    Q_OBJECT
    Q_PROPERTY(qreal frame READ frame WRITE setFrame NOTIFY frameChanged)
    Q_PROPERTY(qreal zPosition1 READ zPosition1 WRITE setzPosition1 NOTIFY zPosition1Changed)
    Q_PROPERTY(qreal zPosition2 READ zPosition2 WRITE setzPosition2 NOTIFY zPosition2Changed)
    Q_PROPERTY(qreal zPosition3 READ zPosition3 WRITE setzPosition3 NOTIFY zPosition3Changed)

    Q_PROPERTY(qreal xPositionCamera READ xPositionCamera WRITE setxPositionCamera NOTIFY zxPositionCameraChanged)

    Q_PROPERTY(qreal die READ die WRITE setDie NOTIFY dieChanged)

public:
    explicit MainWindow(QQuickItem *parent=0);
    ~MainWindow();

signals:
    void frameChanged();
    void zPosition1Changed();
    void zPosition2Changed();
    void zPosition3Changed();
    void zxPositionCameraChanged();
    void dieChanged();

public slots:
    void sync();
    void cleanup();
    qreal frame(){ return m_frame; }
    void setFrame(qreal frame);

    qreal zPosition1(){ return m_zPosition1; }
    void setzPosition1(qreal zPosition1);

    qreal zPosition2(){ return m_zPosition2; }
    void setzPosition2(qreal zPosition2);

    qreal zPosition3(){ return m_zPosition3; }
    void setzPosition3(qreal zPosition3);

    qreal xPositionCamera(){ return m_xPositionCamera; }
    void setxPositionCamera(qreal xPositionCamera);

    qreal die(){ return m_die; }
    void setDie(qreal die);

private slots:
    void handleWindowChanged(QQuickWindow *win);
    void pengzhuang();

private:
    TriangleWindow *m_triangleWindow;
    qreal m_frame;
    qreal m_zPosition1;
    qreal m_zPosition2;
    qreal m_zPosition3;
    qreal m_xPositionCamera;
    qreal m_die;

};

#endif // MAINWINDOW_H
